public class leetcode283 {
    public void moveZeroes(int[] nums) {
        int dest=-1;
        int cur=0;
        while(cur<=nums.length){
            if(nums[cur]==0){
                cur++;
            }else{
                dest++;
                int tmp=nums[dest];
                nums[dest]=nums[cur];
                nums[cur]=tmp;
                cur++;
            }
        }
    }
}
